package com.citcc.api.controller;

import com.citcc.business.bean.CdzFind;
import com.citcc.business.service.CdzFindService;
import com.citcc.common.page.TableDataInfo;
import com.citcc.framework.base.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "活动发现")
@RestController
@RequestMapping("/find")
public class CdzFindController extends BaseController {

    private final CdzFindService cdzFindService;

    @Autowired
    public CdzFindController(CdzFindService cdzFindService) {
        this.cdzFindService = cdzFindService;
    }

    @ApiOperation("分页获取活动发现列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "当前记录起始索引", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query"),
            @ApiImplicitParam(name = "orderByColumn", value = "排序列createTime", paramType = "query"),
            @ApiImplicitParam(name = "isAsc", value = "desc或者asc", paramType = "query")
    })
    @GetMapping("/v2/list")
    public TableDataInfo findList() {
        startPage();
        List<CdzFind> cdzFindList = cdzFindService.getFindList();
        return getDataTable(200, cdzFindList);
    }
}
